package com.basic;

import com.frame.struts.BaseBean;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.utils.CommUtil;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class ProductAndSaleForm extends BaseBean {
    public ProductAndSaleForm() {
    }

	ProductAndSaleEntity pas = new ProductAndSaleEntity();

	public String addProductAndSale() {
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		pas.setQyid(qyid);
		pas.setOptdate(new Date());
		pas.setOptrid(CommUtil.getUserId(request));
		try{
		if(factory.addProductAndSale(pas)){
			//System.out.println("wo zhi xing le!");
				response.sendRedirect("/basic/queryProductAndSale.jsp");
				return "success";
		}
		response.sendRedirect("/basic/failed.jsp");
		}
		catch (Exception e) {

		}

		return "failed";
	}

	public String modifyProductAndSale(){
			HttpServletRequest request = ActionContext.getActionContext().
				getRequest();
			HttpServletResponse response = ActionContext.getActionContext().
				getResponse();
			BasicFactory factory = new BasicFactory();
			String qyid = (String) request.getSession().getAttribute("session_qyid");
			pas.setQyid(qyid);
			pas.setOptdate(new Date());
			pas.setOptrid(CommUtil.getUserId(request));
			factory.deleteProductAndSale(pas.getId());
			try{
			if(factory.addProductAndSale(pas)){
				//System.out.println("wo zhi xing le!");
					response.sendRedirect("/basic/queryProductAndSale.jsp");
					return "success";
			}
			response.sendRedirect("/basic/failed.jsp");
			}
			catch (Exception e) {

			}

			return "failed";
		}


	/**
	 * @return Returns the dz.
	 */
	public String getDz() {
		return pas.getDz();
	}
	/**
	 * @param dz The dz to set.
	 */
	public void setDz(String dz) {
		pas.setDz(dz);
	}
	/**
	 * @return pas. return pas.s the id.
	 */
	public int getId() {
		return pas.getId();
	}
	/**
	 * @param id The id to set.
	 */
	public void setId(int id) {
		pas.setId(id);
	}
	/**
	 * @return pas. return pas.s the jfsj.
	 */
	public String getJfsj() {
		return pas.getJfsj();
	}
	/**
	 * @param jfsj The jfsj to set.
	 */
	public void setJfsj(String jfsj) {
		pas.setJfsj(jfsj);
	}
	/**
	 * @return pas. return pas.s the jzmj.
	 */
	public double getJzmj() {
		return pas.getJzmj();
	}
	/**
	 * @param jzmj The jzmj to set.
	 */
	public void setJzmj(double jzmj) {
		pas.setJzmj(jzmj);
	}
	/**
	 * @return pas. return pas.s the kssj.
	 */
	public String getKssj() {
		return pas.getKssj();
	}
	/**
	 * @param kssj The kssj to set.
	 */
	public void setKssj(String kssj) {
		pas.setKssj(kssj);
	}
	/**
	 * @return pas. return pas.s the mc.
	 */
	public String getMc() {
		return pas.getMc();
	}
	/**
	 * @param mc The mc to set.
	 */
	public void setMc(String mc) {
		pas.setMc(mc);
	}
	/**
	 * @return pas. return pas.s the optdate.
	 */
	public Date getOptdate() {
		return pas.getOptdate();
	}
	/**
	 * @param optdate The optdate to set.
	 */
	public void setOptdate(Date optdate) {
		pas.setOptdate(optdate);
	}
	/**
	 * @return pas. return pas.s the optrid.
	 */
	public String getOptrid() {
		return pas.getOptrid();
	}
	/**
	 * @param optrid The optrid to set.
	 */
	public void setOptrid(String optrid) {
		pas.setOptrid(optrid);
	}
	/**
	 * @return pas. return pas.s the qyid.
	 */
	public String getQyid() {
		return pas.getQyid();
	}
	/**
	 * @param qyid The qyid to set.
	 */
	public void setQyid(String qyid) {
		pas.setQyid(qyid);
	}
	/**
	 * @return pas. return pas.s the recstate.
	 */
	public String getRecstate() {
		return pas.getRecstate();
	}
	/**
	 * @param recstate The recstate to set.
	 */
	public void setRecstate(String recstate) {
		pas.setRecstate(recstate);
	}
	/**
	 * @return pas. return pas.s the remark.
	 */
	public String getRemark() {
		return pas.getRemark();
	}
	/**
	 * @param remark The remark to set.
	 */
	public void setRemark(String remark) {
		pas.setRemark(remark);
	}
	/**
	 * @return pas. return pas.s the sl.
	 */
	public double getSl() {
		return pas.getSl();
	}
	/**
	 * @param sl The sl to set.
	 */
	public void setSl(double sl) {
		pas.setSl(sl);
	}
	/**
	 * @return pas. return pas.s the syje.
	 */
	public double getSyje() {
		return pas.getSyje();
	}
	/**
	 * @param syje The syje to set.
	 */
	public void setSyje(double syje) {
		pas.setSyje(syje);
	}
	/**
	 * @return pas. return pas.s the symj.
	 */
	public double getSymj() {
		return pas.getSymj();
	}
	/**
	 * @param symj The symj to set.
	 */
	public void setSymj(double symj) {
		pas.setSymj(symj);
	}
	/**
	 * @return pas. return pas.s the xsmj.
	 */
	public double getXsmj() {
		return pas.getXsmj();
	}
	/**
	 * @param xsmj The xsmj to set.
	 */
	public void setXsmj(double xsmj) {
		pas.setXsmj(xsmj);
	}
	/**
	 * @return pas. return pas.s the xssr.
	 */
	public double getXssr() {
		return pas.getXssr();
	}
	/**
	 * @param xssr The xssr to set.
	 */
	public void setXssr(double xssr) {
		pas.setXssr(xssr);
	}
	/**
	 * @return pas. return pas.s the ysmj.
	 */
	public double getYsmj() {
		return pas.getYsmj();
	}
	/**
	 * @param ysmj The ysmj to set.
	 */
	public void setYsmj(double ysmj) {
		pas.setYsmj(ysmj);
	}
	/**
	 * @return pas. return pas.s the yssr.
	 */
	public double getYssr() {
		return pas.getYssr();
	}
	/**
	 * @param yssr The yssr to set.
	 */
	public void setYssr(double yssr) {
		pas.setYssr(yssr);
	}
	/**
	 * @return pas. return pas.s the zzj.
	 */
	public double getZzj() {
		return pas.getZzj();
	}
	/**
	 * @param zzj The zzj to set.
	 */
	public void setZzj(double zzj) {
		pas.setZzj(zzj);
	}

}